The mapping context holds information about the state of the mapping process. In OPC Data Access (OPC-DA), the mapping context is represented by an instance of DAMappingContext class. In OPC Unified Architecture (OPC-UA), the mapping context is represented by an instance of UAMappingContext class.
The state of mapping changes in the mapping context, as the mapping process proceeds from your given “starting” object, to its possible constituent objects.
For example, the mapping context contains the information about the OPC server and current OPC node, and parameters for reading and subscription. As the mapping proceeds to deeper level, the properties in the mapping context are propagated to the deeper levels as well, and they change accordingly. For example, if a member is mapped to an OPC-DA node, the NodeDescriptor property of the DAMappingContext changes to reflect the information about the node. If the member represents an OPC branch and contains another object, this new NodeDescriptor will be the basis for mapping the members of the inner object.
Refer to Propagated Parameters for descriptions of attributes that are maintained in the mapping context.
You need to make sure that enough information is provided for the mapping, either through the “starting” mapping context used with the Map method, or by means of the mapping attributes. Typically, for example, the OPC server’s computer and ProgID (or endpoint URL) will not be specified through the mapping attributes, but will come from your code, so that it can be modified in run-time. In OPC-DA, you will therefore create a new DAMappingContext with properly filled ServerDescriptor, and pass it to the Map method. In OPC-UA, you will create a new UAMappingContext with properly filled EndpointDescriptor, and pass it to the Map method.